package com.sofwin.common;

import lombok.Data;

/**
 * @packageName: com.sofwin.common
 * @user: andyliu
 * @date: 2021/12/14 10:47
 * @email 115176513@qq.com
 * @description: 异步请求的响应数据
 */
@Data
public class ResponseEntry {
    // 响应代码
    private  Integer code;
    private  String message;
    private  Object result;
    public ResponseEntry(Integer code,String message,Object result){
        this.code=code;
        this.message=message;
        this.result=result;
    }

    public static ResponseEntry success(String message){
        return new ResponseEntry(200,message,null);
    }
    public static ResponseEntry success(Object data){
        return new ResponseEntry(200,null,data);
    }
    public static ResponseEntry success(String message,Object result){
        return new ResponseEntry(200,message,result);
    }
    public static ResponseEntry error(String message){
        return new ResponseEntry(500,message,null);
    }
    public static ResponseEntry error(String message,Object result){
        return new ResponseEntry(500,message,result);
    }


}
